<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var person = {
        name:'frank',
        age:30,
        say:function(){

            //this === person
            console.log(this.name);
            console.log(this.age);

        },
        say2:function(){
            //利用变量的作用域实现
            var that = this;
            function aa(){
                //console.log(this);
                console.log(that.age)
            }
            aa();

        },
        say3:function(){
            function aa(){
                //console.log(this);
                console.log(this.age)
            }
            //在fun函数运行时指定的this值。
//            aa.call(this);
            aa.apply(this);

        },
        birthday:function(){
            console.log('生日快乐');
            this.age++;
        }
    }

    person.say3();
</script>
</body>
</html>